const app = getApp();
import config from "../../../utils/config.js";
Page({
  data: {
   scroll: [],//scroll image
   hotList: [],//hot rent
   newList: [],//new goods
   brandList: [],//brand list
   topicList: [],//topic list
  },
  onLoad: function () {
    var that = this;
    wx.request({
      url: config.index,
      method: "get",
      success: function(res) {
        // console.log(res.data.data);
        that.setData({
          scroll: res.data.data.banner,
          hotList: res.data.data.hotGoodsList,
          newList: res.data.data.newGoodsList,
          brandList: res.data.data.brandList,
          topicList: res.data.data.topicList,
        });
        // console.log(that.data);
      }
    })
  },
  showTopic(e) {
    // console.log(e.currentTarget.dataset.tid);
    wx.navigateTo({
      url: '../topicDetails/topicDetails?tid=' + e.currentTarget.dataset.tid,
    });
  },
  showStar(e) {
    wx.navigateTo({
      url: '../starDetails/starDetails?sid=' + e.currentTarget.dataset.sid,
    });
  },
  showGoodsDetails(e) {
    // console.log(e.currentTarget.dataset.gid);
    wx.navigateTo({
      url: '../../logs/details/details?id=' + e.currentTarget.dataset.gid,
    });
  },
  // show brand details
  showBrandDetails: function (e) {
    wx.navigateTo({
      url: '../brandDetails/brandDetails?bid=' + e.currentTarget.dataset.bid,
    })
  },
})
